type AppendArgument<Fn, T> = Fn extends (...args: infer P) => infer R
  ? (...arg: [...P, T]) => R
  : never;

// Fn extends (...args: infer R) => infer T ? (...args: [...R, A]) => T : never

type Fn = (a: number, b: string) => number;
type A1 = AppendArgument<Fn, boolean>;

type A3 = AppendArgument<unknown, undefined>;
